home *** CD-ROM | disk | FTP | other *** search
- Path: unix.sri.com!usenet
- From: mklenk@coronacorp.com (Mark Klenk)
- Newsgroups: comp.lang.c
- Subject: Re: open vs fopen?
- Date: 6 Feb 1996 16:22:54 GMT
- Organization: Nuance Communications
- Message-ID: <4f7v8u$3s2@unix.sri.com>
- References: <uEYFxc9nX8WX083yn@mbnet.mb.ca>
- Reply-To: mklenk@coronacorp.com
- NNTP-Posting-Host: 204.75.161.40
-
- Nathan Wild asked:
- >
- >In C, why would one use open and DOS int handles rather than fopen and
- >stdio file handles?
-
- open() and family are really UNIX-isms that DOS adopted.
-
- To answer your question, though:
-
- a) file I/O through open/close/read/write/lseek is generally
- unbuffered and therefore in some cases faster, especially
- in random-access situations
-
- b) ANSI C only defines fopen/fclose/fread/fwrite/fseek, which
- by default usually provide buffered, but more portable, I/O
-
- c) for sequential access, the f*() functions can improve I/O
- performance because they generally do read-ahead and
- write-behind in order to match system block-sizes more
- closely
-
- ---
-
- mklenk@coronacorp.com (Mark Klenk)
-
-
-
-